﻿/// <summary>
/// 单例的基础类，实现单例模式的类可以继承与它
/// </summary>
public class Singleton<T> where T : class, new()
{
    private static T _instance = null;

    public static T Instance
    {
        get
        {
            if (_instance == null)
            {
                _instance = new T();
            }
            return _instance;
        }
    }

    public void SelfDispose()
    {
        _instance = null;
    }
}